function getuseInfo(user_id, term_type, callback) { //获取用户信息
  var api = "http://59.110.174.204:7280/v1.0/api/app/user/getUserInfo?user_id=" + user_id + "&term_type=" + term_type

  wx.request({
    url: api,
    header: {
      'content-type': 'application/x-www-form-urlencoded'
    },
    method: "POST",
    success: res => {
      callback && callback(res.data)
    }
  })
}

function getStationInfo(city_id, callback) { //地铁站点的查询
  var api = "http://59.110.174.204:7280/v1.0/api/metro/station/find?ver=msx-2.0&city_id=" + city_id

  wx.request({
    url: api,
    header: {
      'content_type': 'application/x-www-form-urlencoded'
    },
    method: "POST",
    success: res => {
      callback && callback(res.data)
    }
  })
}

function getTriplist(callback) { //资询行程信息
  var api = "http://59.110.174.204:7280/v1.0/api/app/trip/baseTriplist"
  wx.request({
    url: api,
    header: {
      'content_type': 'application/x-www-form-urlencoded',
      userid: 1
    },
    method: "POST",
    success: res => {
      callback && callback(res.data)
    },
    fail: err => {
      console.log(err)
    }
  })
}

function getBasetrip(id, callback) {
 var http = "http://59.110.174.204:7280/v1.0/api/app/trip/getBaseTrip?trip_no=" + id;
  wx.request({
    url: http,
    header: {
      'content_type': 'application/x-www-form-urlencoded',
      userid: 1
    },
    method: "POST",
    success: res => {
      callback && callback(res.data)
    },
    fail: err => {
      console.log(err)
    }
  })
}


module.exports = {
  getuseInfo: getuseInfo,
  getStation: getStationInfo,
  getTriplist: getTriplist,
  getBasetrip:getBasetrip
}